var app = getApp()
export default {
  postRequest(url,param){
    url = app.globalData.HOST_ADDRESS + url
    console.log(url)
    return new Promise(function (resolve, reject) {
      wx.request({
        header: {"Content-Type":"application/x-www-form-urlencoded"},
        method:"post",
        url: url,
        data: param,
        success: (res) => {
          resolve(res)
        },
        fail: (res) => {
          reject(res)
        }
      })
    })
  },
  getRequest(url, param) {
    url = app.globalData.HOST_ADDRESS + url
    return new Promise(function (resolve, reject) {
      wx.request({
        url: url,
        data: param,
        success: (res) => {
          resolve(res)
        },
        fail: (res) => {
          reject(res)
        }
      })
    })
  }
}
